Added function for parameter validation#38
Conversation
|
Nevermind the checks in the config - just did some testing, will change back. |
ewels
left a comment
There was a problem hiding this comment.
Looking good, but you're starting to hit some of the JSON Schema complexities that are not obvious at first. The more I look through your code the more potential future problems I can see with various different schema structures 😓 I fought with stuff like the varying hierarchies of the required keyword and different structure of definitions and property obejcts for a long time over the summer.
If you can stomach it, the JSON Schema validator package should have dealt with all of this complexity for you already 😉
|
Okay, looks like there's a bit more work left to-do than I expected :-) Will have another go at the schema validator today, see if I can get that running and if it fixes the issues. Then try to make the code more robust. |
|
Okay it's now working and not failing for false-strings, memory objects and the like. |
ewels
left a comment
There was a problem hiding this comment.
Looking awesome! Much happier with this implementation, great job 😊
I wonder if we should have options to skip this function completely, and to hide warnings about unrecognised parameters (maybe specific ones - a param to specify additional expected params).
I'm also a little nervous about the library grab thing in offline environments which is something I only just thought about 😕 @pditommaso - any suggestions about importing Java libraries like this in workflows?
Co-authored-by: Phil Ewels <phil.ewels@scilifelab.se>
|
Yes, the skip function should be easy to implement. And yes it's probably nicer to omit those warnings and only show in case something goes wrong! I will also have to test this a bit more with more fancy pipelines before making a PR over at |
|
Alright did some more testing and all the different schema types seem to validate correctly. Apart from that it should be fine - let me know if you can still find some bugs :-) If we were to add this in the current version to tools, we would need to:
I was also wondering whether we should put the complete function in |
How would this work? |
|
It should be enough to just run this once: That installs all necessary dependencies. |
|
There's also the Well I will do some testing today. If the command line version doesn't work, then a dirty workaround would be to fire up a small NF script which get's the dependencies via @grab . |
|
Okay now I just saw your comments - continuing in the main thread so it's easier to follow. Okay then that's a problem with downloading... also my last two comments won't help solving then I think. Not quite sure about the I'm pretty sure it pulls some other libraries unfortunately :/ Considering that this parameter checking is a nice, but not a required functionality, I'm wondering whether we absolutely need this for offline use? Could just add a warning that "parameter validation not available when running offline" or something like that. Just in case we need to add too much bulk in order to get it to work. Alright I'll try to play around with the JARs now :) |
|
As I feared Not sure if that can be resolved, just putting these dependencies into |
|
Okay turns out we really need those dependencies somehow because groovy fails even if we don't execute the code. It still checks for the libraries. When specifying the dependencies with When Currently the only way I see to make this work is to download the dependencies in one of the two ways mentioned above when running Think I will post this to slack in the hope for more ideas :) |
PR checklist
This adds the
Validationclass in in thelibfolder, which checks parameter for validity.Currenty supports:
enumfieldsparamsIt does not currently exit the program yet, and needs some more testing, so I'M keeping this just as draft for now.